*
* Master file: prepare data for analysis
*

clear all

global dir_main "C:\Users\tbz312\OneDrive - Vrije Universiteit Amsterdam\Documents\replication_package\"

cd "${dir_main}"

do "code\global.do"

do "${dir_code_prepare_data}\filenames.do"

* Prepare per capita gross annual income on the settlement-level
do "${dir_code_prepare_data}\1_PreparePerCapitaGrossAnnualIncome.do"

* Prepare a school-level NABC-based SES index
do "${dir_code_prepare_data}\2_PrepareNABCBasedSES.do"

* Prepare capacities
do "${dir_code_prepare_data}\3_PrepareCapacities.do"

* Prepare ROL-level data
do "${dir_code_prepare_data}\4_PrepareROLLevelData.do"

* Prepare application-level data
do "${dir_code_prepare_data}\5_PrepareApplicationsData.do"

* Prepare matchings
* python3 clean_analysis.py

* Prepare matching data
do "${dir_code_prepare_data}\7_PrepareMatchingData.do"

* Prepare student-level data
do "${dir_code_prepare_data}\8_PrepareStudentLevelData.do"

* Clean-up unnecesary files
erase "${settlement_level_income}"
erase "${ses_2008_2012}"
erase "${data_applications_csv}"
erase "${data_matching_raw}"
erase "${temp_capacities}"
